//++++++++++++++++++++++++++++++++++++++++
// 《Go语言高级开发与实战》源码
//++++++++++++++++++++++++++++++++++++++++
// Author:廖显东（ShirDon）
// Blog:https://www.shirdon.com/
// 知乎：https://www.zhihu.com/people/shirdonl
// 公众号:源码大数据
// 仓库地址：https://gitee.com/shirdonl/goAdvanced
// 仓库地址：https://github.com/shirdonl/goAdvanced
//++++++++++++++++++++++++++++++++++++++++

package main

import (
	"encoding/json"
	"fmt"
)

func main() {
	//jsonStr := `
	//   {
	//           "name": "Shirdon",
	//           "goodAt": "Go Programming"
	//   }
	//   `
	//var mapResult map[string]interface{}
	//err := json.Unmarshal([]byte(jsonStr), &mapResult)
	//if err != nil {
	//	fmt.Println("JsonToMapDemo err: ", err)
	//}
	//fmt.Println(mapResult)

	instance := map[string]interface{}{
		"name":   "Shirdon",
		"goodAt": "Go Programming"}

	jsonStr, err := json.Marshal(instance)

	if err != nil {
		fmt.Println("MapToJsonDemo err: ", err)
	}
	fmt.Println(string(jsonStr))
}
